<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>我的收藏</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/ajax.js"></script>
		<script type="text/javascript" src="../../js/fanhui.js" ></script>
	</head>
	<body>
		<div id="app">
			<header>
				<van-row style="background-color: #FF4444;padding: 10px;color: white;">
					<van-col span="10">
						<p @click="left()">
							<van-icon name="arrow-left" />
						</p>
					</van-col>
					<van-col span="10">
						<p>我的收藏</p>
					</van-col>
				</van-row>
			</header>
			<section>
				<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
				<van-badge-group>
					<van-badge title="收藏列表"></van-badge>
				</van-badge-group>
				<van-row v-for="item in list">
					<div @click="onclick(item.GoodsId)">
						<van-card
						  :price="item.RealPrice"
						  :title="item.GoodsName"
						>
							<div slot="thumb">
								<img :src="item.GoodsImageUrl" onerror="this.src='../../img/520.jpg'">
							</div>
						</van-card>
					</div>
				</van-row>
				</van-pull-refresh>
			</section>
			<footer>

			</footer>
		</div>
	</body>
	<script>
		var user=plus.storage.getItem('user');
		user=JSON.parse(user);
		var vm = new Vue({
			el: "#app",
			data: {
				list:[//收藏商品
					
				],
					finished: false,
					isLoading: false
			},
			methods: {
				onRefresh: function() {						
						setTimeout(() => {
							this.$toast('刷新成功');
							this.isLoading = false;
						}, 500);
					},
				left() {
					plus.webview.close(plus.webview.currentWebview());
				},
				onclick(id){
					var del=plus.webview.create("../details.html","id",{},{shopId:id});
					plus.webview.show(del);
				}
			},
			created: function() {
				_this = this;
				ajax({
					url: "http://dsapi.ysd3g.com/api/MyGoodsCollectList",
					dataType: "jsonp",
					data: {
						p:1,
						key:user.Key
					},
					success: function(res) {
						if(res.Error){
							_this.$toast(res.Msg);
						}else{
							console.log(res.Data);
							_this.list=res.Data;//获取到收藏列表
						}
					}
				});
			}
		})
	</script>
</html>
